package org.NooLab.openNLP.geo;


/* RegionLookupTest.java */

/* Requires subscription to MaxMind GeoIP Region database */

import org.NooLab.openNLP.geo.core.geoip.*;
import java.io.IOException;

class RegionLookupTest {
	
    public static void main(String[] args) {
    	
    	Region regio; 
    	
        try {
            // LookupService cl = new LookupService("/usr/local/share/GeoIP/GeoIPRegion.dat");
        	LookupService cl = new LookupService("D:/dev/java/data/texter/cfg/geo/GeoIP.dat");
            
            regio = cl.getRegion("Utah");
            
            if (regio!=null){
            System.out.println("Country Code: " + regio.countryCode);
            System.out.println("Country Name: " + regio.countryName);
            System.out.println("Region Code: " + regio.region);
            System.out.println("Region Name: " + regionName.regionNameByCode(regio.countryCode,regio.region));
            cl.close();
            }else{
            	System.out.println("not found");	
            }
        }
        catch (IOException e) {
        	e.printStackTrace();
            System.out.println("IO Exception");
        }
    }
}
